# -*- coding:utf-8 -*-
# -------------------------------------------------------------------------------
# Description:  
# Reference:
# Author: 安智军
# Date:   2021/12/17
# -------------------------------------------------------------------------------
import json


def load_json(filepath):
    # filepath = basepath + "/TestDatas/" + filename  # 配合使用config.py文件找到获取json文件的完整路径
    # 调用 load方法获取json中的内容
    with open(filepath, 'r', encoding="utf-8") as f:
        datas = json.load(f)
    return datas


def seconds_to_time(seconds):
    m, s = divmod(seconds, 60)
    h, m = divmod(m, 60)
    print(h,m,s)
    if 0<s<60 and m<=0 and h<=0:
        return ("%.3f 秒" % (s))
    elif  0<m<60 and 0<=s<=60 and h<=0:
        return ("%02d分%.3f秒" % (m,s))
    elif 0<=h<24:
        return ("%d小时%02d分%.3f秒" % (h, m, s))
    else:
        return '测试用例执行时间超过24小时 接口测试用例异常'


# seconds = 516561985/1000
#
# print(seconds_to_time(seconds))